<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="qna.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String writeId = request.getParameter("id");
	QnaWritingManager manager = QnaWritingManager.getInstance();
	QnaWriting writing = manager.select2(Integer.parseInt(writeId));
%>
<c:set var="writing" value="<%=writing%>" />
<c:if test="${! empty writing }">
	<script type="text/javascript">
		function validate(form) {
			oEditors.getById["bbs_content"].exec("UPDATE_CONTENTS_FIELD", []);
			
			if (form.bbs_title.value == "") {
				alert("제목을 입력하세요.");
				return false;
			} else if (form.mb_name.value == "") {
				alert("작성자 이름을 입력하세요.");
				return false;
			} else if (document.getElementById("bbs_content").value == "") {
				alert("내용을 입력하세요.");
				return false;
			}
		}
	</script>

	<%@ include file="/Dmyna/admin/head.jsp"%>

	<style type="text/css">
</style>

<script type="text/javascript" src="../se2/js/HuskyEZCreator.js" charset="utf-8"></script>

	<form action="/qnaupdate.do" method="post"
		enctype="multipart/form-data" onsubmit="return validate(this)">
		<input type="hidden" name="id" value="${writing.writing_id }" />
		<table width="900" align=center cellpadding=0 cellspacing=0>
			<tr>
				<td>

					<div
						style="border:1px solid #ddd; height:34px; background:url(${WEB_ROOT }/img/bbs/title_bg.gif) repeat-x;">
						<div
							style="font-weight: bold; font-size: 14px; margin: 7px 0 0 10px;">
							:: ${writing.bbs_title } ::</div>
					</div>
					<div
						style="height:3px; background:url(${WEB_ROOT }/img/bbs/title_shadow.gif) repeat-x; line-height:1px; font-size:1px;"></div>

					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<colgroup width=90>
						<colgroup width=''>
						<tr>
							<td colspan="2"
								style="background:url(${WEB_ROOT }/img/bbs/title_bg.gif) repeat-x; height:3px;"></td>
						</tr>
						<tr>
							<td colspan=2 height=1 bgcolor=#e7e7e7></td>
						</tr>

						<tr>
							<td class=write_head align="center" height="30">제 목</td>
							<td><input class='ed'
								style='width: 98%; word-break: break-all;' name="bbs_title"
								id="wr_subject" value="${writing.bbs_title }" /></td>
						</tr>
						<tr>
							<td colspan=2 height=1 bgcolor=#e7e7e7></td>
						</tr>

						<tr>
							<td class=write_head align="center">내 용</td>
							<td>
							<textarea name="bbs_content" id="bbs_content" rows="20" cols="145">${writing.bbs_content }</textarea>
	          				</td>
						</tr>
						<tr>
							<td colspan=2 height=1 bgcolor=#e7e7e7></td>
						</tr>
						<tr>
							<td class=write_head align="center" height="30" rowspan="2">이미지</td>
							<td><input class='ed' style="width: 50%;" type="file"
								name="image_name" id="image_name" /></td>
						</tr>
						<tr>
							<td><c:if test="${!empty writing.bbs_img }">
									<img src="upload/small.${writing.bbs_img }" />
									<br />
								</c:if></td>
						</tr>
						<tr>
							<td colspan=2 height=1 bgcolor=#e7e7e7></td>
						</tr>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td>
									<div style="clear: both; height: 30px;">
										<div style="float: right; margin-top: 6px;">
											<input type="image" id="btn_submit"
												src="${WEB_ROOT }/img/bbs/btn_modify.gif" border=0
												accesskey='s' />&nbsp; <a
												href="${WEB_ROOT }/qna/qnaList.jsp"> <img id="btn_list"
												src="${WEB_ROOT }/img/bbs/btn_list.gif" border=0></a>
										</div>
									</div>
								</td>
							</tr>
						</table>
						<tr>
							<td colspan=2 height=1 bgcolor=#dddddd></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</form>

</c:if>

<script type="text/javascript">

var oEditors = [];

nhn.husky.EZCreator.createInIFrame({

    oAppRef: oEditors,

    elPlaceHolder: "bbs_content",

    sSkinURI: "../se2/SmartEditor2Skin.html",

    fCreator: "createSEditor2"

});

</script>

<%@ include file="/Dmyna/admin/tail.jsp"%>

